home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / et / et3_0-a1.lha / et3 / src / Data.h < prev    next >
C/C++ Source or Header  |  1992-07-10  |  4KB  |  161 lines

  1. #ifndef Data_First
  2. #ifdef __GNUG__
  3. //pragma once
  4. #pragma interface
  5. #endif
  6. #define Data_First
  7.  
  8. #include "Object.h"
  9. #include "Symbol.h"
  10. #include "TypeMatcher.h"
  11.  
  12. class StreamBuf;
  13. class MemBuf;
  14. class Bitmap;
  15. class SeqCollection;
  16. class Converter;
  17.  
  18. //---- Data --------------------------------------------------------------------
  19.  
  20. class Data : public Object {
  21. protected:
  22.     char *name;
  23.     Symbol creator, type;
  24.     bool isnew;
  25.     Class *classtype;
  26.     Converter *converter;
  27. public:
  28.     MetaDef(Data);
  29.     Data(bool untitled= FALSE, char *name= 0);
  30.     ~Data();
  31.  
  32.     virtual char *FullName();
  33.     virtual char *ShortName();
  34.     char *Name()
  35.     { return FullName(); }
  36.  
  37.     Class *GetClassType()
  38.     { return classtype; }
  39.     void SetClassType(Class *cl)
  40.     { classtype= cl; }
  41.  
  42.     virtual bool IsUntitled();
  43.     virtual Symbol Type();
  44.     virtual Symbol Creator();
  45.     virtual StreamBuf *GetStreamBuf();
  46.     StreamBuf *GetStreamBufForReading();
  47.     StreamBuf *GetStreamBufForWriting();
  48.  
  49.     virtual bool IsWritable();
  50.     virtual bool IsReadable();
  51.     virtual bool IsExecutable();
  52.     virtual bool IsDirectory();
  53.     virtual bool IsETFormat();
  54.     virtual bool IsValid();
  55.     virtual bool IsCCode();
  56.     virtual bool IsAscii();
  57.  
  58.     virtual long UniqueId();
  59.     virtual int SizeHint();
  60.  
  61.     virtual Bitmap *GetBitmap();
  62.     virtual SeqCollection *GetContents();
  63.     virtual bool HasContents();
  64.     virtual Data *GetParent();
  65.  
  66.     virtual long ModifiedAt();
  67.  
  68.     virtual Object *AsObject(Class *want);
  69.     bool FindConvertersFor(Class *w1, Class *w2= 0, Class *w3= 0,
  70.                         Class *w4= 0, Class *w5= 0);
  71.     virtual bool CanConvert(Class *want);
  72.  
  73.     OStream& PrintOn(OStream&);
  74.     IStream& ReadFrom(IStream&);
  75. };
  76.  
  77. //---- FileData ----------------------------------------------------------------
  78.  
  79. class FileData : public Data {
  80. protected:
  81.     long sizehint;
  82.     long modtime;
  83.     int uniqueid;
  84.     int isDeep;
  85.     bool lookDeep;
  86.     bool valid;
  87.     bool isETFormat;
  88.     bool isSystem;
  89.     bool isAscii;
  90.     bool isCCode;
  91.     bool isExec;
  92.     bool isDir;
  93.  
  94.     void WhatType(bool deep= FALSE);
  95. public:
  96.     MetaDef(FileData);
  97.     FileData(char *nm, bool untitled= FALSE, bool lookDeep= TRUE);
  98.         // lookDeep indicates that the contents of the file is
  99.         // considered for determining a file type
  100.  
  101.     char *FullName();
  102.     char *ShortName();
  103.  
  104.     char *GetLoadDir();
  105.     char *GetBaseName()
  106.     { return ShortName(); }
  107.     char *PathName()
  108.     { return FullName(); }
  109.  
  110.     bool IsUntitled();
  111.     Symbol Type();
  112.     int SizeHint();
  113.     StreamBuf *GetStreamBuf();
  114.     long UniqueId();
  115.     Bitmap *GetBitmap();
  116.  
  117.     bool IsWritable();
  118.     bool IsReadable();
  119.     bool IsExecutable();
  120.     bool IsETFormat();
  121.     bool IsCCode();
  122.     bool IsAscii();
  123.     bool IsDirectory();
  124.     bool IsValid();
  125.     long ModifiedAt();
  126.     Symbol Creator();
  127.     SeqCollection *GetContents();
  128.     bool HasContents();
  129.     Data *GetParent();
  130.  
  131.     OStream& PrintOn(OStream&);
  132.     IStream& ReadFrom(IStream&);
  133. };
  134.  
  135. //---- StreamBufData -----------------------------------------------------------
  136.  
  137. class StreamBufData : public Data {
  138. public:
  139.     MetaDef(StreamBufData);
  140.     StreamBufData(StreamBuf *sb= 0, const Symbol &type= cDocTypeUndef);
  141.     void SetType(Symbol);
  142.     int SizeHint();
  143.     StreamBuf *GetStreamBuf();
  144. protected:
  145.     StreamBuf *sb;
  146. };
  147.  
  148. //---- ObjectData --------------------------------------------------------------
  149.  
  150. class ObjectData : public Data {
  151.     Object *object;
  152. public:
  153.     MetaDef(ObjectData);
  154.     ObjectData(Object *op);
  155.     ~ObjectData();
  156.     Object *AsObject(Class *want);
  157.     bool CanConvert(Class *want);
  158. };
  159.  
  160. #endif
  161.